﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>评论</title>
    <link href="~/EasyUI/themes/icon.css" rel="stylesheet" />
    <link href="~/EasyUI/themes/default/easyui.css" rel="stylesheet" /> 
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="~/EasyUI/jquery.easyui.min.js"></script> 
    <script type="text/javascript" src="~/Scripts/jquery.msgProcess.js"></script>
    <script src="~/Scripts/Showdatetime.js"></script>

    <script type="text/javascript">
        $(function () {
            $('#editWindow').window('close');

            $("#tbList").datagrid({
                width: 'auto',
                height: 'auto',
                fitColumns: true,
                striped: true,
                singleSelect: false,
                url: '/admin/Comment/Getlist',
                //queryParams:{},
                loadMsg: '数据加载中请稍后……',
                pagination: true,//启用分页，默认每页10行
                rownumbers: false,//显示行号.
                pageSize: 10,//设置 页容量为 5
                pageList: [5, 10, 20],//设置 页容量下拉框
                columns: [[

                   { field: 'id', title: 'id', width: 30 },
                   { field: 'nickName', title: '用户昵称', width: 150 },
                   {
                       field: 'Comment', title: '评论内容', width: 200
                   },
                   { field: 'userIp', title: '用户IP', width: 50 },
                   {
                       field: 'addtime', title: '添加时间', width: 120, formatter: function (value) {
                           var aa = eval('new ' + (value.replace(/\//g, '')));
                           return aa.format("yyyy-MM-dd hh:mm:ss");
                       }
                   }
                ]],
                toolbar: [ {
                    iconCls: 'icon-remove',
                    text: "删除",
                    handler: removeRow
                }],
                onSelect: function (rowI, rowD) {
                    selectedRowIndex = rowI;//将选中行的下标 设置给全局变量
                },
                onDblClickRow: function () {
                    editRow();
                }
            });
        })

        //删除方法
        function removeRow() {
            //获取选中行里的数据！
            var rowData = $("#tbList").datagrid("getSelections");
            if (rowData.length>0) {
                for (var i = 0; i < rowData.length; i++) {
                    $.post("/admin/Comment/Dlecomment", "id=" + rowData[i].id, null, "JSON");
                }
                $("#tbList").datagrid("reload");//多行删除
                $.messager.alert("系统提示", "删除成功", "info");
            }


        }




    </script>
</head>
<body>
    <table id="tbList" style="width:auto;height:auto"></table>

    <div id="editWindow" class="easyui-window" title="My Window" style="width:900px;height:400px;"
         data-options="iconCls:'icon-save',modal:true">

    </div>
</body>
</html>

